package com.hex.liyue.giftmodule.presenter;

import com.hex.liyue.commonmodule.manager.HttpManager;
import com.hex.liyue.commonmodule.manager.UserManager;
import com.hex.liyue.commonmodule.net.ResponseListener;
import com.hex.liyue.commonmodule.utils.L;
import com.hex.liyue.giftmodule.bean.GiveGiftsBean;
import com.hex.liyue.giftmodule.bean.HarvesGiftsBean;


/**
 * Created by $cmm on 2016/6/21.
 * <p/>
 *  礼物列表的业务类
 */
public class GiveGiftsPresenter {
    private IGiveGiftsView iGiveGiftsView;

    public GiveGiftsPresenter(IGiveGiftsView iGiveGiftsView) {
        this.iGiveGiftsView = iGiveGiftsView;
    }

    public void getGiveGifts(int page,int pagenum) {
        iGiveGiftsView.showLod("加载中...");
        HttpManager.getInstance().getGiveGifts(UserManager.getUserId(),page,pagenum, new ResponseListener<GiveGiftsBean>() {
            @Override
            public void onSuccess(GiveGiftsBean giveGiftsBean) {
                iGiveGiftsView.closeLod();
                iGiveGiftsView.setAdapter(giveGiftsBean);
            }

            @Override
            public void onFailure(String responseresult) {
                iGiveGiftsView.closeLod();
                iGiveGiftsView.showT(responseresult);
            }
        });
    }
}